#include "Effects.h"

Effects::Effects(void)
{
	_timeAnimation=500; //500miliseconds
}
Effects::Effects(int _type)
{
	_typeEffects=_type;
}
Effects::Effects(float x, float y, float vx, float vy, int deltaTime,int resourceName,CResourceManager* rm):MovingObject(x,y,vx,vy,deltaTime,resourceName,rm)
{

}
Effects::Effects(int x, int y, int Width, int Height, float vx, float vy, int deltaTime, LPD3DXSPRITE spriteHandler, LPDIRECT3DTEXTURE9 image):MovingObject(x,y,Width,Height,vx,vy,deltaTime,spriteHandler,image)
{

}
void Effects::SetTimeAnimation(float _time)
{
	_timeAnimation=_time;
	_timeStartAnimation=GetTickCount();
}
void Effects::SetTypeEffects(int _type)
{
	_typeEffects=_type;
	if(_typeEffects==1)
	{
		_sprite=_spriteGombaDied;
	}
	else
	{
		if (_typeEffects==2)
		{
			_sprite=_spriteTurtleDied;
		}
		else
		{
			_sprite=_spriteBulletExplosion;
		}
	}
}
void Effects::SetXY(float _eX,float _eY)
{
	_x=_eX;
	_y=_eY;
}
void Effects::SetVX(float vx)
{
	_vx=vx;
}
void Effects::SetVY(float vy)
{
	_vy=vy;
}
void Effects::Move()
{
	_x+=_vx;
	_y+=_vy;
}
void Effects::Render()
{
	float _timeNow=GetTickCount();
	if(_timeNow-_timeStartAnimation<_timeAnimation)
	{
		_sprite->Render(_x,_y);
	}

}